<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>maint_req_process</title>
<?php
	include('Connection.php');
?>

</head>

<body>
	<?php

	$loc = $_POST['car_location'];
	$model = $_POST['choose_car'];
	$query = "SELECT VehicleSno FROM car WHERE CarLocation='$loc' AND CarModel='$model'";
	$currDate = date("Y-m-d h:i:s");
	$problem = $_POST['prob'];

	$result = mysql_query($query);
	
	$sno = mysql_fetch_object($result);//mysql_fetch_row($result);
	
	$insert = "INSERT INTO maintenance_request_problems (VehicleSno, RequestDateTime, Problem)
			   VALUES ('$sno->VehicleSno', '$currDate', '$problem')";
	
	mysql_query($insert);

	header("Location: https://academic-php.cc.gatech.edu/groups/cs4400_Group_7/HomepageEmployee.php");
?>
</body>
</html>